﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admincp/Admin.Master" AutoEventWireup="true" CodeBehind="Loinhuan.aspx.cs" Inherits="TPCN.Admincp.Loinhuan" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="nameholder" runat="server">
    Thống kê lợi nhuận
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="maincontent" runat="server">
    <!-- Script manager -->
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        <Scripts>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
        </Scripts>
    </telerik:RadScriptManager>

    <div class="date message info">
        <span class="date-item">Ngày bắt đầu : 
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="*" ControlToValidate="dateStart"></asp:RequiredFieldValidator>
            <telerik:RadDatePicker ID="dateStart" runat="server" Width="160px" 
            Culture="vi-VN">
                <Calendar ID="Calendar1" UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False"
                    ViewSelectorText="x" runat="server">
                </Calendar>
                <DateInput ID="DateInput1" runat="server" DateFormat="dd/MM/yyyy" DisplayDateFormat="dd/MM/yyyy">
                </DateInput>
                <DatePopupButton HoverImageUrl="" ImageUrl="" />
            </telerik:RadDatePicker>
        </span><span class="date-item">Ngày kết thúc : <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="*" ControlToValidate="dateEnd"></asp:RequiredFieldValidator>
            <telerik:RadDatePicker ID="dateEnd" runat="server" Width="160px" 
            Culture="vi-VN">
                <Calendar ID="Calendar2" UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False"
                    ViewSelectorText="x" runat="server">
                </Calendar>
                <DateInput ID="DateInput2" runat="server" DateFormat="dd/MM/yyyy" DisplayDateFormat="dd/MM/yyyy">
                </DateInput>
                <DatePopupButton HoverImageUrl="" ImageUrl="" />
            </telerik:RadDatePicker>
        </span>
        <asp:Button ID="btnSubmit" runat="server" Text="Tính lợi nhuận" 
            CssClass="button button-blue" onclick="btnSubmit_Click" />
    </div>

    <div class="message warning">
        Công thức : Lợi nhuận = Tổng doanh thu (theo hóa đơn bán) - Tổng vốn (theo hóa đơn nhập)
    </div>

    <div class="money">
        <span>Doanh thu : <span class="red"><asp:Literal ID="lblDoanhthu" runat="server" Text="0" /></span></span>
        <span>Tiền vốn : <span class="red"><asp:Literal ID="lblVon" runat="server" Text="0" /></span></span>
        <span>Lợi nhuận : <span class="red"><asp:Literal ID="lblMoney" runat="server" Text="0" /></span></span>
    </div>
    <%--<div>
        <asp:Panel ID="GridViewPanel" runat="server">
            <asp:GridView ID="HBDGridView" runat="server" AutoGenerateColumns="False" Width="100%"
                DataKeyNames="HoadonbanID" Height="16px" OnRowCommand="HDBGridView_RowCommand"
                AllowPaging="True" GridLines="None" CssClass="mGrid" AlternatingRowStyle-CssClass="alt"
                PagerStyle-CssClass="pgr" OnPageIndexChanging="HDBGridView_PageIndexChanging"
                PageSize="15">
                <AlternatingRowStyle CssClass="alt" />
                <Columns>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:CheckBox ID="chkSelect" runat="server" CssClass="chkItem" />
                        </ItemTemplate>
                        <HeaderTemplate>
                            <asp:CheckBox ID="chkSelectAll" runat="server" CssClass="chkHeader" />
                        </HeaderTemplate>
                        <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="30px" />
                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="30px" />
                    </asp:TemplateField>
                    <asp:BoundField DataField="HoadonbanID" HeaderText="Mã hóa đơn bán" ReadOnly="True">
                        <HeaderStyle CssClass="hide" />
                        <ItemStyle CssClass="hide" />
                    </asp:BoundField>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:LinkButton ID="cmdViewDetail" runat="server" CommandArgument='<%# Eval("HoadonbanID") %>'
                                CommandName="cmdViewDetail">Chi tiết</asp:LinkButton>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Ngày lập">
                        <ItemTemplate>
                            <asp:Literal ID="lblNgaylap" runat="server" Text='<%# FormatDatetime(Eval("Ngaylap")) %>' />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Khách hàng">
                        <ItemTemplate>
                            <asp:Literal ID="lblTenkhach" runat="server" Text='<%# GetCustomerNameById(Eval("KhachID")) %>' />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Hình thức chiết khấu">
                        <ItemTemplate>
                            <asp:Literal ID="lblHinhthucchietkhau" runat="server" Text='<%# GetDiscountNameByID(Eval("Hinhthucchietkhau")) %>' />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Chiết khấu">
                        <ItemTemplate>
                            <asp:Literal ID="lblChietkhau" runat="server" Text='<%# FormatDiscount(Eval("Hinhthucchietkhau"), Eval("Chietkhau")) %>' />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Tổng tiền">
                        <ItemTemplate>
                            <asp:Literal ID="lblTien" runat="server" Text='<%# Tongtien(Eval("HoadonbanID")) %>' />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:TemplateField>
                </Columns>
                <HeaderStyle HorizontalAlign="Left" />
                <PagerSettings FirstPageText="Đầu" LastPageText="Cuối" Mode="NumericFirstLast" NextPageText="Tiếp"
                    PreviousPageText="Trước" PageButtonCount="5" />
                <PagerStyle CssClass="pgr" />
            </asp:GridView>
        </asp:Panel>
        <asp:Panel ID="DetailGridPanel" runat="server">
            <asp:GridView ID="DetailGridView" runat="server" AutoGenerateColumns="False" Width="100%"
                DataKeyNames="ChitiethoadonbanID" Height="16px" AllowPaging="True" GridLines="None"
                CssClass="mGrid" AlternatingRowStyle-CssClass="alt" PagerStyle-CssClass="pgr"
                PageSize="15" OnPageIndexChanging="DetailGridView_PageIndexChanging">
                <AlternatingRowStyle CssClass="alt" />
                <Columns>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:CheckBox ID="chkSelect" runat="server" CssClass="chkItem" />
                        </ItemTemplate>
                        <HeaderTemplate>
                            <asp:CheckBox ID="chkSelectAll" runat="server" CssClass="chkHeader" />
                        </HeaderTemplate>
                        <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="30px" />
                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="30px" />
                    </asp:TemplateField>
                    <asp:BoundField DataField="ChitiethoadonbanID" ReadOnly="True">
                        <HeaderStyle CssClass="hide" />
                        <ItemStyle CssClass="hide" />
                    </asp:BoundField>
                    <asp:TemplateField HeaderText="Sản phẩm">
                        <ItemTemplate>
                            <asp:Literal ID="lblProductName" runat="server" Text='<%# GetProductNameById(Eval("HangID")) %>' />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="Soluong" HeaderText="Số lượng" />
                    <asp:BoundField DataField="Dongia" HeaderText="Đơn giá" />
                    <asp:TemplateField>
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:TemplateField>
                </Columns>
                <HeaderStyle HorizontalAlign="Left" />
                <PagerSettings FirstPageText="Đầu" LastPageText="Cuối" Mode="NumericFirstLast" NextPageText="Tiếp"
                    PreviousPageText="Trước" PageButtonCount="5" />
                <PagerStyle CssClass="pgr" />
            </asp:GridView>
            <div class="backButton clear">
                <asp:Button ID="btnBack" runat="server" CssClass="button button-green" Text="Trở lại"
                    OnClick="btnBack_Click" />
            </div>
        </asp:Panel>
    </div>--%>
    <!-- Ajax Manager -->
    <telerik:RadAjaxLoadingPanel ID="loadingPanel" runat="server" MinDisplayTime="0" />
    <telerik:RadAjaxManager ID="ajax" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="GridViewPanel">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="GridViewPanel" LoadingPanelID="loadingPanel" />
                    <telerik:AjaxUpdatedControl ControlID="DetailGridPanel" LoadingPanelID="loadingPanel" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
        </span>
</asp:Content>
